import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

import MyLogin from '../views/MyLogin.vue'
import Home from '../views/Home.vue'
import EchartsView from '../components/EchartsView.vue'
import PermissionList from '../components/PermissionList.vue'
import userlist from '../components/userlist.vue'
import userone from '../components/userone.vue'
import userupdate from '../components/userupdate.vue'



const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: "/login"
  }, 
  {
    path: '/login',
    name: 'login',
    component: MyLogin
  },
  {
    path: '/home',
    name: 'home',
    component: Home,
    children: [
      {
        path: '/echarts',
        name: 'echarts',
        component: EchartsView,
        meta: {
          title: "数据展示"
        }
      },
      {
        path: '/permissionlist',
        name: 'permissionlist',
        component: PermissionList,
        meta: {
          title: "权限列表"
        }
      },{
        path: '/user',
        name: 'user',
        component: userone,
        redirect:"/userlist",
        meta: {
          title: "住户信息"
        },
        children: [ 
          {
            path: '/userlist',
            name: 'userlist',
            component: userlist,
            meta: {
              // classifyTitle: "用户信息",//分类标题
              title: "住户列表"
            }
          },{
            path: '/userupdate',
            name: 'userupdate',
            component: userupdate,
            meta: {
              // classifyTitle: "用户信息",//分类标题
              title: "住户信息修改"
            }
          },
        ]
      },
    ]
  },
  



]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
